<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自定义函数与调用</title>
</head>
<body>
    <script>
        function getSum(n,m){
            var sum = 0;
            for(var i = n; i<=m ;i++){
                sum += i;
            }
            document.write(n+ '~' + m+ '之间的数相加为：' + sum);
        }
        getSum(5,10);
        getSum(100,1000);
    </script>
</body>
</html>